﻿namespace LinkedTU.Data.Providers
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using LinkedTU.Common.Interfaces;
    using LinkedTU.Models;
    using System.Globalization;

    public class LanguageProvider : IClassificatorProvider<Language>
    {
        public IEnumerable<Language> GetClassificators()
        {
            var languages = new List<Language>();
            var cultures = CultureInfo.GetCultures(CultureTypes.AllCultures);

            foreach (var culture in cultures)
            {
                languages.Add(new Language
                {
                    DisplayName = culture.EnglishName,
                    ISOCode = culture.TwoLetterISOLanguageName
                });
            }

            return languages;
        }
    }
}